<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<style>
    div[lay-id="datalist"] .layui-table-cell{
        height:auto !important;
    };
</style>
<body class="laytp-container">
<div id="opt_nav">
</div>

<div class="layui-card" id="search-form">
    <div class="layui-card-body">
        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">销售方名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">销售方联系人</label>
                        <div class="layui-input-block">
                            <input type="text" name="lianer" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <input type="hidden" id="type" name="type">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="TableSearchButton" type="button"><i class="layui-icon layui-icon-search"></i>查询</button>
                                <button class="layui-btn layui-btn-primary" onclick="listTableReset()" id="TableSearchReset" type="reset" ><i class="layui-icon layui-icon-refresh"></i>重置</button>
<!--                                <div id="search_open" onclick="toggle_search()">-->
<!--                                    <i class="layui-icon layui-icon-down"></i>展开-->
<!--                                </div>-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>


<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md12" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
    </div>
</script>
<script>

    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;


        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });
        setSouTableExport('储备销售方报表');
        table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_chu_deal_tai_list)
            ,where: {}
            , page: true, height: 'full-140'
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response
            ,contextmenu:get_table_contextmenu(soulTable)
            ,text: TabInit.text,totalRow: true
            ,parseData: function (res) {

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.data.total,
                    "data": res.data.data.data
                };
            }
            , cols: [[
                {type: 'checkbox', fixed: 'left'}
                ,{type:'numbers',title:'序号',fixed:'left',totalRowText: '合计'}
                ,{field: 'name', title: '销售方名称'}
                ,{field: 'lianer', title: '销售方联系人'}
                ,{field:'',title:'销售方进项票累计(元)',totalRow: true,templet: function(d){
                    return '<span class="colorlan" onclick="openNavPage(\'储备进项票明细信息\',\'piao_chu/detail.php?status=1'+'&xiaoer='+encodeURI(d.name)+'\');">'+parseFormatNum(d.piaofee)+'</span>';
                }}
                ,{field:'',title:'进项支付累计A',totalRow: true,templet: function(d){
                    return '<span class="colorlan" onclick="openNavPage(\'储备进项支付明细信息\',\'hou_chujin/detail.php?status=1'+'&fuer='+encodeURI(d.name)+'\');">'+parseFormatNum(d.chujinfee)+'</span>';
                }}
                ,{field:'',title:'税费支付累计(元)',totalRow: true,templet: function(d){
                    return '<span class="colorlan" onclick="openNavPage(\'储备税费支付明细信息\',\'hou_chushui/detail.php?status=1'+'&fuer='+encodeURI(d.name)+'\');">'+parseFormatNum(d.chushuifee)+'</span>';
                }}

                ,{field:'',title:'税费支付(对公)B',totalRow: true,templet: function(d){
                        return '<span class="colorlan" onclick="openNavPage(\'储备税费支付明细信息\',\'hou_chushui/detail.php?status=1'+'&fuer='+encodeURI(d.name)+'&fulei='+encodeURI('对公')+'\');">'+parseFormatNum(d.chushuiduigongfee)+'</span>';
                    }}
                ,{field:'leizhifee',title:'累计支付销售方金额(元)A+B',totalRow: true,templet: function(d){return parseFormatNum(d.leizhifee);}}



                ,{field:'piaofee',title:'销售方可签采购合同金额(元)',totalRow: true,templet: function(d){return parseFormatNum(d.piaofee);}}
                ,{field:'',title:'销售方已签采购合同金额(元)',totalRow: true,templet: function(d){
                    return '<span class="colorlan" onclick="openNavPage(\'储备合同信息\',\'contract_chu/index.php?status=1'+'&gonger='+encodeURI(d.name)+'\');">'+parseFormatNum(d.conmoney)+'</span>';
                }}
                ,{field:'daiqianfee',title:'销售方待签采购合同金额(元)',totalRow: true,templet: function(d){return parseFormatNum(d.daiqianfee);}}


                // ,{field:'',title:'合同累计结算金额(元)',templet: function(d){
                //     if(d.jiemoney){
                //         return '<span class="colorlan" onclick="openNavPage(\'储备合同结算信息\',\'contract_chu_jie/index.php?status=1'+'&gonger='+encodeURI(d.name)+'\');">'+d.jiemoney+'</span>';
                //     }else{
                //         return '';
                //     }
                // }}



            ]]
            , done: function (res) {
                soulTable.render(this);
            }
        });

        listTableSearch(form, table);

    });



</script>
</body>
</html>
